<template>
  <div>
    <!-- 文字阴影 -->
    <h1 style="text-align: center; text-shadow: rgb(145 145 145) 3px 3px 5px">
      今日热榜
    </h1>
    <a-spin :spinning="spining" tip="加载热搜中...">
      <div class="contant">
        <a-row>
          <a-col
            :xxl="{ span: 7, offset: 1 }"
            :lg="{ span: 10, offset: 1 }"
            :md="{ span: 10, offset: 1 }"
            v-for="(item, index) in newsList"
            :key="index"
            style="margin-top: 20px"
          >
            <div class="box">
              <div class="div_s">
                <div class="div_s-title">
                  <div class="l">
                    <h3>{{ item.title }}</h3>
                  </div>
                  <div class="r">
                    <span>{{ item.subtitle }}</span>
                  </div>
                </div>
                <ul class="div_s-con">
                  <li v-for="(newItem, idx) in item.data" :key="idx">
                    <span>{{ newItem.index }}</span>
                    <a :href="newItem.mobilUrl" target="_blank"
                      ><span>{{ newItem.title }}</span>
                      <span>{{ newItem.hot }}</span></a
                    >
                  </li>
                </ul>
              </div>
              <div class="ref">
                <a-icon type="reload" />
              </div>
            </div>
          </a-col>
        </a-row>
      </div>
    </a-spin>
  </div>
</template>

<script>
export default {
  data() {
    return {
      newsList: [],
      spining: true,
    };
  },
  mounted() {
    this.getNewsList();
  },
  methods: {
    getNewsList() {
      this.$axios
        .get("/api/util/newslist.php")
        .then(({ data: { data: res } }) => {
          this.newsList = res;
          this.spining = false;
        });
    },
  },
};
</script>

<style scoped>
.contant .ref {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
  overflow: hidden;
}

.contant .ref img {
  height: 15px;
  width: 15px;
  cursor: pointer;
}

.contant .ref img:hover {
  animation: refImg 2s linear infinite;
}

.contant .box {
  position: relative;
  box-sizing: border-box;
  padding: 12px 20px;
  border-radius: 6px;
  background-color: #fff;
  box-shadow: 0px 0px 20px -5px rgb(83 83 83 / 20%);
}

.contant .box .refd {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(214, 211, 211, 0.5);
  z-index: 1;
}

.contant .box .refd .refround {
  margin: auto;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 4px solid #000;
  border-left-color: transparent;
  animation: refdroundi 1s linear infinite;
}

.contant .box .div_s {
  font-size: 16px;
}

.contant .box .div_s .div_s-title {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #282a2d;
}

.contant .box .div_s .div_s-title .l {
  display: flex;
  align-items: center;
}

.contant .box .div_s .div_s-title .l img {
  height: 16px;
  padding-right: 6px;
}

.contant .box .div_s .div_s-title .l h3 {
  font-size: 16px;
}

.contant .box .div_s .div_s-title .r {
  display: flex;
  align-items: center;
}

.contant .box .div_s .div_s-title .r span {
  font-size: 13px;
}

.contant .box .div_s .div_s-con::-webkit-scrollbar {
  width: 5px;
}

.contant .box .div_s .div_s-con::-webkit-scrollbar-thumb {
  background-color: #c0c0c0;
  border-radius: 6px;
}

.contant .box .div_s .div_s-con::-webkit-scrollbar-thumb:hover {
  background-color: red;
  border-radius: 6px;
}

.contant .box .div_s .div_s-con::-webkit-scrollbar-track {
  box-shadow: inset 0 0 0 #c0c0c0;
}

.contant .box .div_s .div_s-con {
  height: 200px;
  font-size: 14px;
  font-weight: normal;
  color: #282a2d;
  overflow-y: auto;
  padding: 0;
}

.contant .box .div_s .div_s-con li {
  display: flex;
  min-height: 21px;
  margin-bottom: 10px;
  word-wrap: break-word;
  line-height: 1.5;
}

.contant .box .div_s .div_s-con li > span {
  display: inline-block;
  margin-right: 10px;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background-color: rgb(88, 111, 142);
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  overflow: hidden;
}

.contant .box .div_s .div_s-con li:nth-of-type(1) > span {
  background-color: rgb(255, 80, 34);
}

.contant .box .div_s .div_s-con li:nth-of-type(2) > span {
  background-color: rgb(255, 144, 38);
}

.contant .box .div_s .div_s-con li:nth-of-type(3) > span {
  background-color: rgb(246, 192, 50);
}

.contant .box .div_s .div_s-con li > a {
  flex: 1;
  display: flex;
  justify-content: space-between;
  margin-top: -2.5px;
}

.contant .box .div_s .div_s-con li > a > span:nth-of-type(1) {
  flex: 1;
  white-space: normal;
  display: -webkit-box;
  overflow: hidden;
  color: #656565d1;
}

.contant .box .div_s .div_s-con li > a > span:nth-of-type(2) {
  text-align: right;
  white-space: nowrap;
  margin-left: 8px;
  color: #6c757d;
}
</style>
